home *** CD-ROM | disk | FTP | other *** search
Modula Implementation | 1996-03-01 | 5.5 KB | 155 lines | [TEXT/3PRM] |
- implementation module dialogs;
-
- import mac_types;
-
- :: ProcPtr :== Int;
-
- // Initialization
-
- InitDialogs :: !ProcPtr !Toolbox -> Toolbox;
- InitDialogs resumeProc t = code (resumeProc=D0,t=U)(z=Z){
- call .InitDialogs
- };
-
- // Creating and Disposing of Dialogs
-
- NewDialog :: !Ptr !Rect !{#Char} !Bool !Int !WindowPtr !Bool !Int !Handle !Toolbox -> (!DialogPtr, !Toolbox);
- NewDialog dStorage (left,top,right,bottom) title visible procID behind goAwayFlag refCon items t
- = code (right=W,bottom=W,left=W,top=W,dStorage=D0,title=O0D1SD2,visible=D3,procID=D4,
- behind=D5,goAwayFlag=D6,refCon=D7,items=A0,t=U) (dialog=D0,z=I8Z)
- {
- instruction 0x92E1FFF8 | stw r23,-8(sp)
- call .NewDialog
- };
-
- NewCDialog :: !Ptr !Rect !{#Char} !Bool !Int !WindowPtr !Bool !Int !Handle !Toolbox -> (!DialogPtr,!Toolbox);
- NewCDialog dStorage (left,top,right,bottom) title visible procID behind goAwayFlag refCon items t
- = code (right=W,bottom=W,left=W,top=W,dStorage=D0,title=O0D1SD2,visible=D3,procID=D4,
- behind=D5,goAwayFlag=D6,refCon=D7,items=A0,t=U) (dialog=D0,z=I8Z)
- {
- instruction 0x92E1FFF8 | stw r23,-8(sp)
- call .NewColorDialog
- };
-
- CloseDialog :: !DialogPtr !Toolbox -> Toolbox;
- CloseDialog theDialog t = code (theDialog=D0,t=U)(z=Z){
- call .CloseDialog
- };
-
- DisposDialog :: !DialogPtr !Toolbox -> Toolbox;
- DisposDialog theDialog t = code (theDialog=D0,t=U)(z=Z){
- call .DisposeDialog
- };
-
- // Handling Dialog Events
-
- ModalDialog :: !ProcPtr !DialogPtr !Toolbox -> (!Int,!Toolbox);
- ModalDialog filterProc dialog t = code (filterProc=R2D0,dialog=O0D1U,t=U)(itemHit=W,z=Z){
- call .ModalDialog
- };
-
- IsDialogEvent :: !(!Int,!Int,!Int,!Int,!Int,!Int) !Toolbox -> (!Bool,!Toolbox);
- IsDialogEvent event tb = IsDialogEvent1 event;
-
- IsDialogEvent1 :: !(!Int,!Int,!Int,!Int,!Int,!Int) -> (!Bool,!Toolbox);
- IsDialogEvent1 (what,message,when,h,v,modifiers) = code (modifiers=W,h=W,v=W,when=L,message=L,what=W)(result=D0,z=I16Z){
- instruction 0x38610000 | addi r3,sp,0
- call .IsDialogEvent
- instruction 0x70630001 | andi. r3,r3,1
- instruction 0x7C6300D0 | neg r3,r3
- };
-
- DialogSelect :: !(!Int,!Int,!Int,!Int,!Int,!Int) !Toolbox -> (!Bool,!DialogPtr,!Int,!Toolbox);
- DialogSelect r t = DialogSelect1 r;
-
- DialogSelect1 :: !(!Int,!Int,!Int,!Int,!Int,!Int) -> (!Bool,!DialogPtr,!Int,!Toolbox);
- DialogSelect1 (what,message,when,h,v,modifiers) = code (modifiers=W,h=W,v=W,when=L,message=L,what=W)(result=D0,theDialog=L,itemHit=W,z=I16Z){
- instruction 0x3821FFFA | subi sp,sp,6
- instruction 0x38610006 | addi r3,sp,6
- instruction 0x38810000 | addi r4,sp,0
- instruction 0x38A10004 | addi r5,sp,4
- call .DialogSelect
- instruction 0x70630001 | andi. r3,r3,1
- instruction 0x7C6300D0 | neg r3,r3
- };
-
- // Invoking Alerts
-
- // Manipulating Items in Dialogs and Alerts
-
- GetDItem :: !DialogPtr !Int !Toolbox -> (!Int,!Handle,!Rect,!Toolbox);
- GetDItem theDialog itemNo tb
- = (itemType,item,(left,top,right,bottom),NewToolbox);
- {
- (itemType,item,right,bottom,left,top) = GetDItem1 theDialog itemNo tb
- };
-
- GetDItem1 :: !DialogPtr !Int !Toolbox -> (!Int,!Handle,!Int,!Int,!Int,!Int);
- GetDItem1 theDialog itemNo t = code (theDialog=R14D0,itemNo=D1,t=O0D2O2D3O6D4U)(itemType=W,item=L,right=W,bottom=W,left=W,top=W){
- call .GetDialogItem
- };
-
- SetIText :: !Handle !{#Char} !Toolbox -> Toolbox;
- SetIText item text t = code (item=D0,text=SD1,t=U)(z=Z){
- call .SetDialogItemText
- };
-
- GetIText :: !Handle !{#Char} !Toolbox -> (!{#Char},!Toolbox);
- GetIText item text tb = (GetIText1 item text tb, NewToolbox);
-
- GetIText1 :: !Handle !{#Char} !Toolbox -> {#Char};
- GetIText1 item text t = code (item=D0,text=U,t=U)(new_text=A0){
- instruction 0x3AA00000 | li r21,0
- instruction 0x92B70004 | stw r21,4(r23)
- instruction 0x38970007 | addi r4,r23,7
- call .GetDialogItemText
- };
-
- SelIText :: !DialogPtr !Int !Int !Int !Toolbox -> Toolbox;
- SelIText theDialog itemNo strtSel endSel t = code (theDialog=D0,itemNo=D1,strtSel=D2,endSel=D3,t=U)(z=Z){
- call .SelectDialogItemText
- };
-
- OutlineButtonFunction :: ProcPtr;
- OutlineButtonFunction = code ()(function_address=D0){
- call .myoutlinebuttonfunction
- }
-
- DisposeRoutineDescriptor :: !ProcPtr !Toolbox -> Toolbox;
- DisposeRoutineDescriptor proc_ptr t = code (proc_ptr=D0,t=U)(z=Z){
- call .DisposeRoutineDescriptor
- }
-
- /*
- DialogFilterFunction :: ProcPtr;
- DialogFilterFunction = code ()(function_address=D0){
- instruction 0x41FA 0x0006 | lea l2(pc),a0
- instruction 0x2008 | move.l a0,d0
- instruction 0x6046 | bra.s l3:
- instruction 0x2017 | l2: move.l (sp),d0
- instruction 0x508F | addq.l #8,sp
- instruction 0x205F | move.l (sp)+,a0
- instruction 0x2257 | move.l (sp),a1
- instruction 0x2E80 | move.l d0,(sp)
- instruction 0x0C50 0x0006 | cmp.w #6,(a0)
- instruction 0x670E | beq.s update
- instruction 0x0C50 0x0003 | cmp.w #3,(a0)
- instruction 0x6714 | beq.s key_down
- instruction 0x4251 | ret_false: clr.w (a1)
- instruction 0x426F 0x0004 | clr.w 4(sp)
- instruction 0x4E75 | rts
- instruction 0x32BC 0xFFFF | update: move.w #-1,(a1)
- instruction 0x3F7C 0xFFFF 0x0004 | move.w #-1,4(sp)
- instruction 0x4E75 | rts
- instruction 0x1028 0x0005 | key_down: move.b 5(a0),d0
- instruction 0x0C00 0x000D | cmp.b #13,d0
- instruction 0x6706 | beq.s return_key
- instruction 0x0C00 0x0003 | cmp.b #3,d0
- instruction 0x66DC | bne.s ret_false
- instruction 0x32BC 0x0001 | return_key: move.w #1,(a1)
- instruction 0x3F7C 0xFFFF 0x0004 | move.w #-1,4(sp)
- instruction 0x4E75 | rts
- | l3:
- };
- */
-